<template>
	<view class="">
		<view class="">
			<!-- 2.0.19支持autoBack，默认为false -->
			<u-navbar leftText="活动详情" :autoBack="true">
			</u-navbar>
		</view>
		<view class="con-body" style="background-color: #F2F3F5;">
			<view class="main-service uni-cell-90" style="padding-bottom: 10rpx; width: 96%; margin-left: 2%;">
				<view class="user-list">

					<view style="padding: 20rpx;">
						<view style="width: 48%; float: left;">
							<u-image :src="detail.image" width="300rpx" height="200rpx"></u-image>
						</view>
						<view style="color: #666666; margin-top: 10rpx; font-size: 30rpx; line-height: 50rpx;">
							<view>
								{{detail.title}}
							</view>
							<view>
								结束时间：{{detail.end_time}}
							</view>
							<view>
								数量：{{detail.a_join.num}}
							</view>
							<view>
								实际支付：{{detail.price}}元
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="main-service uni-cell-90" style="padding: 10rpx 0rpx;">
			<view class="user-list" v-if="detail.a_join.code">
				<view style="padding: 20rpx 20rpx 0 20rpx;">报名信息</view>
				<view style="padding-left: 20rpx; padding-right: 20rpx; padding-bottom: 20rpx;">
					

					<view class="d_view" v-if="detail.a_join.name">
						<text class="l_title">联系人</text>
						<text class="d_content">{{detail.a_join.name}}</text>
					</view>

					<view class="d_view" v-if="detail.a_join.tel">
						<text class="l_title">联系电话</text>
						<text class="d_content">{{detail.a_join.tel}}</text>
					</view>

					<view class="d_view">
						<text class="l_title">报名时间</text>
						<text class="d_content">{{detail.a_join.join_time}}</text>
					</view>
					<view class="d_view" style="text-align: center;width: 100%;margin: 20rpx 0;" v-if="detail.a_join.status == 1">
						
						<view class="d_content" style="margin-left: 30%;width: 40%;">
							<u-qrcode ref="qrcode" canvas-id="qrcode" size="150"
								:value="detail.a_join.code"></u-qrcode>
						</view>
					</view>
					<view class="d_view" v-if="detail.a_join.status == 1">
						<text class="l_title">确认识别码</text>
						<text class="d_content"
							style="color: #000; font-weight: 800;">{{detail.a_join.code}}</text>
					</view>
				</view>
			</view>
			<view class="user-list" v-if="detail.order.id">
			
				<view style="padding: 20rpx 20rpx 0 20rpx;">订单信息</view>
				<view style="padding-left: 20rpx; padding-right: 20rpx; padding-bottom: 20rpx;">	
					<view class="d_view">
						<text class="l_title">订单编号</text>
						<text class="d_content">{{detail.order.order_no}}</text>
					</view>
					<view class="d_view">
						<text class="l_title">订单状态</text>
						<text class="d_content">{{detail.order.payment_status >= 1 ? '支付成功' : '未支付'}}</text>
					</view>
					<view class="d_view">
						<text class="l_title">支付金额</text>
						<text class="d_content" style="color: red;">￥{{detail.order.payment_amount}}元</text>
					</view>
					<view class="d_view">
						<text class="l_title">收款备注</text>
						<text class="d_content">{{detail.order.payment_remark}}</text>
					</view>
					<view class="d_view">
						<text class="l_title">订单备注</text>
						<text class="d_content">{{detail.order.order_remark}}</text>
					</view>
				</view>
			</view>
			
		</view>



		<u-modal :show="showDel" title="提示" width="500rpx" @cancel="showDel = false"
			:content='detail.status == 0 ? "确定取消活动吗？" : "确定删除活动么？"' showCancelButton></u-modal>
		<view v-if="detail.status == 0">
			<u-button :customStyle="btnStyle" @click="showDel = true">取消参与</u-button>
		</view>
	</view>
	</view>
</template>

<script>
	import {
		getMyActiveDetail
	} from "@/service/communitService.js";
	export default {
		data() {
			return {
				showDel: false,
				detail: {
					id: 1,
					code: 20210102,
					store: '龙海首创DIY',
					title: '家人朋友一起DIY蛋糕',
					icon: 'https://s4.ax1x.com/2022/02/17/H5aAWn.png',
					num: 2,
					end_time: "2020-03-01",
					amount: "50.00",
					status: 0,
					status_label: '待参加',
					order_no: '311248282138428832',
					contact: '王某',
					tel: '13111111111',
					create_time: '2022-02-28 12:00'
				},
				id: 0,
				btnStyle: {
					width: '96%',
					borderRadius: '40rpx',
					marginTop: '40rpx',
					marginBottom: '40rpx',
					backgroundImage: "url('https://s4.ax1x.com/2022/02/22/HxzlJf.png')",
					backgroundSize: '100% 80rpx',
					color: '#FFFFFF'
				}
			}
		},
		onLoad(options) {
			this.id = options.id;
			getMyActiveDetail({
				id: this.id
			}).then(this.getMyActiveDetail);
		},
		methods: {
			getMyActiveDetail(e) {
				if (e.code == 200) {
					this.detail = e.result;
				}
			}
		}
	}
</script>

<style lang="scss">
	.l_title {
		font-size: 32rpx;
		color: #999999;
		float: left;
	}

	.d_content {
		color: #666666;
		font-size: 32rpx;
	}

	.d_view {
		margin-top: 30rpx;
		text-align: right;
	}
</style>
